package com.walkline.notes.dao;

import org.json.me.JSONException;
import org.json.me.JSONObject;

import com.walkline.notes.NotesException;
import com.walkline.notes.NotesSDK;
import com.walkline.notes.inf.Note;

public class NotesNote extends NotesObject implements Note
{
	private int _id = 0;
	private String _contents = "";
	private String _postdate = "";
	private double _postdate_ms = 0;
	private String _modifydate = "";
	private double _modifydate_ms = 0;
	private int _priority = 0;
	private int _progress = 0;
	private boolean _deleted = false;

	public NotesNote(NotesSDK notes, JSONObject jsonObject) throws NotesException
	{
		super(notes, jsonObject);

		_id = jsonObject.optInt("id");
		_contents = jsonObject.optString("contents");
		_postdate = jsonObject.optString("postdate");
		try {_postdate_ms = jsonObject.getDouble("postdate_ms");} catch (JSONException e1) {}
		_modifydate = jsonObject.optString("modifydate");
		try {_modifydate_ms = jsonObject.getDouble("modifydate_ms");} catch (JSONException e) {}
		_priority = jsonObject.optInt("priority");
		_progress = jsonObject.optInt("progress");
		_deleted = jsonObject.optBoolean("deleted");
	}

	public int getID() {return _id;}

	public String getContents() {return _contents;}

	public String getPostDate() {return _postdate;}

	public double getPostDateMS() {return _postdate_ms;}

	public String getModifyDate() {return _modifydate;}

	public double getModifyDateMS() {return _modifydate_ms;}

	public int getPriority() {return _priority;}

	public int getProgress() {return _progress;}

	public boolean isDeleted() {return _deleted;}
}